Ext.define('AmpleHarvest.util.tpdsrestutil', 
{
    extend			: 'Ext.util.Observable',
    listenerName	: 'dataResponse',
	
	getLink	: function(arr_root, arr_linkTree, str_key, str_return)
	{
		if(Ext.isString(arr_root))
		{
			arr_root = [arr_root];
		}
		
		// TODO: might not need the below check anymore
		if(Ext.isObject(arr_linkTree))
		{
			arr_linkTree = [arr_linkTree];
		}

		if(Ext.isArray(arr_linkTree))
		{
			for (var var_i in arr_root)
			{
   				for (var var_j in arr_linkTree)
   				{
   					if(arr_linkTree[var_j][str_key] == arr_root[var_i])
   					{
   						return arr_linkTree[var_j][str_return];
   					}
   				}
			}
		}
		return false;
	}	
});